package com.handpay.zztong.hp.balancequery;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.handpay.framework.utils.CommonUtils;
import com.handpay.zztong.hp.R;
import com.handpay.zztong.hp.balancequery.bean.MicroBalanceQueryBean;
import com.handpay.zztong.hp.base.activity.ZZTongActivity;
import com.handpay.zztong.hp.bean.ActionBar;
import com.handpay.zztong.hp.utils.BankUtils;

/**
 * 余额查询结果
 *
 * @author ppliu
 */
public class BalanceQueryActivity extends ZZTongActivity {
    private MicroBalanceQueryBean balanceQueryBean;

    @Override
    protected boolean isShownTabs() {
        return false;
    }

    @Override
    public ActionBar getActivityActionBar() {
        return new ActionBar(this.getString(R.string.balanceenquiry_title), true);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        this.setContentView(R.layout.balance_inquiry);
        super.onCreate(savedInstanceState);
        balanceQueryBean = getIntent().getParcelableExtra("MicroBalanceQueryBean");
        ((TextView) findViewById(R.id.balanceTextView)).setText(CommonUtils.formatMoney(CommonUtils.objectToDouble(balanceQueryBean.getBalance()) / 100));
        ((TextView) findViewById(R.id.cardNoTextView)).setText(CommonUtils.formattingCard(balanceQueryBean.getCardNo()));
        ((TextView) findViewById(R.id.bank_name)).setText(balanceQueryBean.getBankName());
        ((ImageView) findViewById(R.id.bank_logo)).setImageResource(BankUtils.getBankIcon(balanceQueryBean.getBankName()));
        ((TextView) findViewById(R.id.single_debit_card_limit)).setText(balanceQueryBean.getBankType());
    }

    @Override
    public void onSwiperPlugOff() {
        // 回到HPFunction界面
        onFunctionTab(null);
    }
}
